package com.example;

import com.example.observer.Observer;
import com.example.utils.ObserverHelper;

import java.rmi.RemoteException;

/**
 * 服务端，提供observer
 */
public class ObserverProvider {
    public static void main(String[] args) throws RemoteException {

        Observer observer = new Monitor();
        // 注册observer
        ObserverHelper observerHelper = new ObserverHelper();

        // 如果使用不同的主机的话，记得使用具体的ip
        // ObserverHelper observerHelper = new ObserverHelper("192.168.100.131", ObserverHelper.DEFAULT_PORT);

        observerHelper.registerObserver("observer", observer);
        System.out.println("observer注册成功");
    }
}
